//
//  Config.h
//  XiaoDangJia
//
//  Created by yanyan on 14-8-11.
//  Copyright (c) 2014年 Ma Yiming. All rights reserved.
//

#import "MBProgressHUD.h"
#import "HTTP.h"
#import "HorizonLine.h"
#import "ErrorHandle.h"
#import "Reachability.h"
#import "NSString+MD5Addition.h"
#import "SDWebImageManager.h"
#import "UIImageView+WebCache.h"
#import "UIButton+WebCache.h"
#import "MobClick.h"
#import "NSDate+DateUtil.h"

#import "VerticalLine.h"
#import "SystemUtils.h"
#import "UINavigationController+TRVSNavigationControllerTransition.h"
#import "UIDevice+DeviceType.h"
#import "OpenUDID.h"
#import "UIImage+Resize.h"
#import "UIImageViewAddtion.h"
#import "Masonry.h"
#import "COLOR.h"
#import "Base64.h"
#import "AWHttpTool.h"
#import "UserUnit.h"
#import "MJExtension.h"


//IOS7及以后

#define MBALERT(alertMsg)         UIWindow *window=[[UIApplication sharedApplication].windows lastObject]; \
MBProgressHUD *ahud=[MBProgressHUD showHUDAddedTo:window animated:YES];\
ahud.userInteractionEnabled = NO;\
ahud.mode = MBProgressHUDModeText;\
ahud.labelText = alertMsg;\
[ahud hide:YES afterDelay:1];

#define OSVersionIsAtLeastiOS6   ([[UIDevice currentDevice].systemVersion floatValue]>= 6.0 ? YES:NO)

#define OSVersionIsAtLeastiOS7   ([[UIDevice currentDevice].systemVersion floatValue]>= 7.0 ? YES:NO)

#define OSVersionIsAtLeastiOS8   ([[UIDevice currentDevice].systemVersion floatValue]>= 8.0 ? YES:NO)

#define ALBUMNAME @"智橙"
//颜色
#define RGBA(r,g,b,a) [UIColor colorWithRed:((r)/255.0f) green:((g)/255.0f) blue:((b)/255.0f) alpha:(a)]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
//统一背景色
#define BACKVIEWCOLOR HexRGB(0xebebeb)
//十六进位颜色转换
#define HexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define HexRGBAlpha(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]


// 屏幕的高度，宽度
#define kScreenHeight CGRectGetHeight([[UIScreen mainScreen] bounds])
#define kScreenWidth  CGRectGetWidth([[UIScreen mainScreen] bounds])
//iPhone4 4s机型
#define ScreenInch4s (kScreenHeight < 568)
//通知
#define kRefreshCustomerTrendsNoti          @"RefreshCustomerTrendsNoti"


#define KAPPCHANNEL_SERVER_IP @"KAPPCHANNEL_SERVER_IP"
#define KAPPONLINE_SERVER_IP  @"KAPPONLINE_SERVER_IP"

#define KSWITCH_LANDSCAPE   @"KSWITCH_LANDSCAPE"
#define KSWITCH_NOWIFIALERT @"KSWITCH_NOWIFIALERT"

#define KREMEMBER_PHONE   @"KREMEMBER_PHONE"

#define APPSTORE_URL @"http://itunes.apple.com/app/id948157716?mt=8"

#define KFIRSTRUN @"KFIRSTRUN"

#define KFIRSTREPORTINFO @"KFIRSTREPORTINFO"

#define KPHOTO_SINGLEWIDTH ((kScreenWidth - 10*2 - 5*3)/4);

/* 打印开关控制 */

#define DEBUGLOG 1

#ifdef DEBUGLOG
#       define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#       define DLog(...)
#endif

//#define LOG_CLOSE

#ifndef LOG_CLOSE
#    define NSLog(...) NSLog(__VA_ARGS__)
#    define printf(...) printf(__VA_ARGS__)
#else
#    define NSLog(...) {}
#    define printf(...) {}
#endif



#define NotNull(obj) (![obj isEqual:[NSNull null]])

#define EMPTYSTRING_HANDLE(str) ([SystemUtils emptyStringResolve:str])

#define HTTPERROR_CANNOTREACH @"无法连接到网络"
#define HTTPERROR_DATAFAIL @"数据请求失败"

#define KEY_WINDOW  [[UIApplication sharedApplication]keyWindow]

//#define LIBEVEN_TIMER 1

//以iPhone6的375宽为基准的矢量
#define VECTOR_IPHONE6 (kScreenWidth == 375 ? 1:(kScreenWidth < 375?(kScreenWidth+15)/375:(kScreenWidth-15)/375))

//iPhone4 4s机型
#define ScreenInch4S (kScreenHeight < 568)


//#define MONITORLISTCELL_HEIGHT  352.0/230

//本地化
#define LANGUAGE(str)\
    (NSLocalizedString(str, str))

#define LONGBTN_FONT [UIFont systemFontOfSize:18]
#define NAVBAR_FONT  [UIFont systemFontOfSize:17]
#define HOME_FONT  [UIFont systemFontOfSize:15 * VECTOR_IPHONE6]


#define SETTINGCELL_FONT  [UIFont systemFontOfSize:14]


#define K_NEWFRIENDHANDLEMSG_NOTIF @"K_NEWFRIENDHANDLEMSG_NOTIF"

#define K_FRIENDCHANGE_NOTIF @"K_FRIENDCHANGE_NOTIF"


#define NAVBARHEIGHT_STATUSBAR  (self.navigationController.navigationBar.frame.size.height + (OSVersionIsAtLeastiOS7?20:0))

#define KFRIENDCELL_NAME_OFFSETX  76.f

#define KHOME_FRESH_DEVICELIST_NOTI @"KHOME_FRESH_DEVICELIST_NOTI"

#define KANOTHERLOGIN_NOTI @"KANOTHERLOGIN_NOTI"


